unit USharedMemorySendForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, UVRSharedMemory, UVRConsts;

type
  TForm1 = class(TForm)
    mmoLog: TMemo;
    btnSend: TButton;
    edtInput: TEdit;
    edtHandle: TEdit;
    procedure btnSendClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  GSharedMemoryFactory: TVRSharedMemoryFactory;

implementation

{$R *.dfm}

procedure TForm1.btnSendClick(Sender: TObject);
var
  mem: TVRSharedMemory;
begin
  mem := GSharedMemoryFactory.GetSharedMemory(SVRBitmapBufferName);
  mem.Write(PChar(edtInput.text)^, edtInput.GetTextLen);
  mmoLog.Lines.Add('Written: ' + edtInput.Text);
  if StrToIntDef(edtHandle.Text, 0) <> 0 then
    SendMessage(StrToInt(edtHandle.Text), $500, 0, 0);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  GSharedMemoryFactory := TVRSharedMemoryFactory.Create;
end;

end.
